module.exports = app => {
  const { router, controller, middleware } = app;
  const jwtAuth = middleware.jwt(app.config.jwt);
  // 用户管理
  router.post('/api/v1/admin/adminLogin', controller.v1.users.adminLogin)
  router.post('/api/v1/admin/getUsers', jwtAuth, controller.v1.users.getUsers)
  router.post('/api/v1/admin/createUser', jwtAuth, controller.v1.users.createUser)
  router.post('/api/v1/admin/editUser', jwtAuth, controller.v1.users.editUser)
  router.post('/api/v1/admin/deleteUser', jwtAuth, controller.v1.users.deleteUser)
  router.post('/api/v1/admin/batchDeleteUsers', jwtAuth, controller.v1.users.batchDeleteUsers)
  router.post('/api/v1/admin/searchUserInfo', jwtAuth, controller.v1.users.searchUserInfo)
  // 文章管理
  router.post('/api/v1/admin/getArticles', jwtAuth, controller.v1.articles.getArticles)
  router.post('/api/v1/admin/getArticle', jwtAuth, controller.v1.articles.getArticle)
  router.post('/api/v1/admin/editArticle', jwtAuth, controller.v1.articles.editArticle)
  router.post('/api/v1/admin/deleteArticle', jwtAuth, controller.v1.articles.deleteArticle)
  router.post('/api/v1/admin/batchDeleteArticles', jwtAuth, controller.v1.articles.batchDeleteArticles)
  // 后台文章图片上传
  router.post('/api/v1/admin/uploadArticle', controller.v1.articles.uploadArticle)
  // 收藏管理
  router.post('/api/v1/admin/getCollections', jwtAuth, controller.v1.collections.getCollections)
  router.post('/api/v1/admin/createCollection', jwtAuth, controller.v1.collections.createCollection)
  router.post('/api/v1/admin/editCollection', jwtAuth, controller.v1.collections.editCollection)
  router.post('/api/v1/admin/deleteCollection', jwtAuth, controller.v1.collections.deleteCollection)
  router.post('/api/v1/admin/batchDeleteCollections', jwtAuth, controller.v1.collections.batchDeleteCollections)
  router.post('/api/v1/admin/getCollectionArticles', jwtAuth, controller.v1.collections.getCollectionArticles)
  // 打卡管理
  router.post('/api/v1/admin/createTask', jwtAuth, controller.v1.tasks.createTask)
  router.post('/api/v1/admin/editTask', jwtAuth, controller.v1.tasks.editTask)
  router.post('/api/v1/admin/deleteTask', jwtAuth, controller.v1.tasks.deleteTask)
  router.post('/api/v1/admin/batchDeleteTasks', jwtAuth, controller.v1.tasks.batchDeleteTasks)
  // 后台打卡图片上传
  router.post('/api/v1/admin/uploadTask', controller.v1.tasks.uploadTask)
  // 设置管理
  router.post('/api/v1/admin/getActiveSetting', jwtAuth, controller.v1.settings.getActiveSetting)
  router.post('/api/v1/admin/getSettings', jwtAuth, controller.v1.settings.getSettings)
  router.post('/api/v1/admin/getSetting', jwtAuth, controller.v1.settings.getSetting)
  router.post('/api/v1/admin/createSetting', jwtAuth, controller.v1.settings.createSetting)
  router.post('/api/v1/admin/editSetting', jwtAuth, controller.v1.settings.editSetting)
  router.post('/api/v1/admin/deleteSetting', jwtAuth, controller.v1.settings.deleteSetting)
  router.post('/api/v1/admin/batchDeleteSettings', jwtAuth, controller.v1.settings.batchDeleteSettings)
  router.post('/api/v1/admin/changeSettingStatus', jwtAuth, controller.v1.settings.changeSettingStatus)
  // 测试管理
  router.post('/api/v1/admin/getTests', jwtAuth, controller.v1.tests.getTests)
  router.post('/api/v1/admin/getUserTests', jwtAuth, controller.v1.tests.getUserTests)
  router.post('/api/v1/admin/getTestById', jwtAuth, controller.v1.tests.getTestById)
  router.post('/api/v1/admin/getTestByUser', jwtAuth, controller.v1.tests.getTestByUser)
  router.post('/api/v1/admin/createTest', jwtAuth, controller.v1.tests.createTest)
  router.post('/api/v1/admin/editTest', jwtAuth, controller.v1.tests.editTest)
  router.post('/api/v1/admin/deleteTest', jwtAuth, controller.v1.tests.deleteTest)
  router.post('/api/v1/admin/batchDeleteTests', jwtAuth, controller.v1.tests.batchDeleteTests)
  router.post('/api/v1/admin/calculateScore', jwtAuth, controller.v1.tests.calculateScore)
  // 资源管理
  router.post('/api/v1/admin/getFiles', controller.v1.files.getFiles)
}